package com.han.fu.api.business.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.han.fu.api.business.entity.File;
import com.han.fu.api.business.mapper.FileMapper;
import com.han.fu.api.business.service.IFileService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文件接口实现类
 *
 * @author Star.zhu
 * @since 2020-03-26
 */
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements IFileService {


    /**
     * 文件明细查询
     *
     * @param id 明细ID
     * @return
     */
    @Override
    public String queryFileDetail(String id) {
        File file = super.getById(id);
        if (null != file) {
            return file.getName();
        }
        return null;
    }

    /**
     * 根据业务ID删除文件
     *
     * @param businessId
     */
    @Override
    public void updateByBusinessId(String businessId) {
        baseMapper.updateByBusinessId(businessId);
    }

    /**
     * 根据业务ID查询文件列表
     *
     * @param businessId
     * @return List<String>
     */
    @Override
    public List<String> queryFilesByBusinessId(String businessId) {
        return baseMapper.queryFilesByBusinessId(businessId);
    }

}